import React from "react";
import type { Good } from "@/type/SearchType";
import "./GoodItem.scss"
import { useNavigate } from "react-router-dom";

interface GoodItemProps {
   good: Good;
}

const GoodItem: React.FunctionComponent<GoodItemProps> = ({ good }) => {
   const navigate = useNavigate();
   return (
      <div className="good-item" onClick={()=>navigate( `/good-detail?goodsId=${good.goods_id}`)}>
         <div className="img">
            <img src={good.goods_image} alt="" />
         </div>
         <div className="name ellipsis-multi">{good.goods_name}</div>
         <div className="bottom">
            <span className="price">￥{good.goods_price_max}</span>
            <span className="old-price">￥{good.line_price_max}</span>
         </div>
      </div>
   );
};

export default GoodItem;
